<?php

namespace connection;

/*
define("IP_SQL", "localhost");
define("USER_SQL","root");
define("PASS_SQL","");
define("DB_SQL","rocotito");
*/
define("IP_SQL", "rocotito.db.6600397.hostedresource.com");
define("USER_SQL","rocotito");
define("PASS_SQL","ep9fTswI8g");
define("DB_SQL","rocotito");

class MySQL{
	
	
	private $connection;
	private $total_querys;
	
	public function MySQL(){
		if(!isset($this->connection)){
			$this->connection = (mysql_connect(IP_SQL,USER_SQL,PASS_SQL)) or die(mysql_error());
			mysql_select_db(DB_SQL,$this->connection) or die(mysql_error());
		}
	}
	
	public function query($query){
		$this->total_query++;
		$result = mysql_query($query,$this->connection);
		if(!$result){
			echo 'MySQL Error: '.mysql_error();
			exit;
		}
		return $result;
	}
	
	public function fetch_array($query){
		return mysql_fetch_array($query);
	}
	
	public function num_rows($query){
		return mysql_num_rows($query);
	}
	
	public function getTotalQuery(){
		return $this->total_query;
	}
}

?>